/*     */ package com.lmpop.trade.ti_voteoption;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.io.PrintStream;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_voteoptionInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_voteoptionInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  25 */     Ti_voteoption ti_voteoption = new Ti_voteoption();
/*  26 */     ti_voteoption.setOption_id(map.getString("option_id"));
/*  27 */     ti_voteoption.setVote_id(map.getString("vote_id"));
/*  28 */     ti_voteoption.setOption_name(map.getString("option_name"));
/*  29 */     ti_voteoption.setOption_count(map.getInt("option_count"));
/*     */ 
/*  31 */     String result_code = "0";
/*     */     try {
/*  33 */       insert(dbmMgr, ti_voteoption);
/*     */     } catch (ApplicationException e) {
/*  35 */       e.printStackTrace();
/*  36 */       result_code = "1";
/*     */     }
/*  38 */     map.setString("result_code", result_code);
/*  39 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_voteoption ti_voteoption)
/*     */     throws ApplicationException
/*     */   {
/*  48 */     dbmMgr.update("insertTi_voteoption", ti_voteoption);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  58 */     String pkid_string = map.getString("pkid");
/*  59 */     String result_code = "0";
/*     */     try {
/*  61 */       if (!pkid_string.equals("")) {
/*  62 */         String[] pkStr = pkid_string.split("\\|");
/*  63 */         for (int i = 0; i < pkStr.length; i++)
/*  64 */           if (!pkStr[i].equals("")) {
/*  65 */             delete(dbmMgr, pkStr[i]);
/*  66 */             deleteByVoteId(dbmMgr, pkStr[i]);
/*     */           }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  70 */       e.printStackTrace();
/*  71 */       result_code = "1";
/*     */     }
/*  73 */     map.setString("result_code", result_code);
/*  74 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  83 */     dbmMgr.update("deleteTi_voteoption", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap deleteByVoteId(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  95 */     String pkid_string = map.getString("pkid");
/*  96 */     String result_code = "0";
/*     */     try {
/*  98 */       if (!pkid_string.equals("")) {
/*  99 */         String[] pkStr = pkid_string.split("\\|");
/* 100 */         for (int i = 0; i < pkStr.length; i++)
/* 101 */           if (!pkStr[i].equals(""))
/* 102 */             deleteByVoteId(dbmMgr, pkStr[i]);
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e) {
/* 106 */       e.printStackTrace();
/* 107 */       result_code = "1";
/*     */     }
/* 109 */     map.setString("result_code", result_code);
/* 110 */     return map;
/*     */   }
/*     */ 
/*     */   public void deleteByVoteId(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 119 */     System.out.print("=============" + pkid);
/* 120 */     dbmMgr.update("deleteTi_voteoptionByVoteId", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 132 */     Ti_voteoption ti_voteoption = new Ti_voteoption();
/* 133 */     ti_voteoption.setOption_id(map.getString("option_id"));
/* 134 */     ti_voteoption.setVote_id(map.getString("vote_id"));
/* 135 */     ti_voteoption.setOption_name(map.getString("option_name"));
/* 136 */     ti_voteoption.setOption_count(map.getInt("option_count"));
/*     */ 
/* 138 */     String result_code = "0";
/*     */     try {
/* 140 */       update(dbmMgr, ti_voteoption);
/*     */     } catch (ApplicationException e) {
/* 142 */       e.printStackTrace();
/* 143 */       result_code = "1";
/*     */     }
/* 145 */     map.setString("result_code", result_code);
/* 146 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_voteoption ti_voteoption)
/*     */     throws ApplicationException
/*     */   {
/* 155 */     dbmMgr.update("updateTi_voteoption", ti_voteoption);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 165 */     Ti_voteoption ti_voteoption = (Ti_voteoption)obj;
/* 166 */     if (start == 0)
/* 167 */       start = 0;
/*     */     else {
/* 169 */       start = (start - 1) * limit;
/*     */     }
/* 171 */     ti_voteoption.setStart(Integer.valueOf(start));
/* 172 */     ti_voteoption.setLimit(Integer.valueOf(limit));
/* 173 */     return this.queryList.getList("getListByTi_voteoptionPage", ti_voteoption);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 185 */     Ti_voteoption ti_voteoption = (Ti_voteoption)obj;
/* 186 */     List list = this.queryList.getList("getCountByObjTi_voteoption", ti_voteoption);
/* 187 */     int count = 0;
/* 188 */     if ((list != null) && (list.size() > 0)) {
/* 189 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 190 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 191 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 194 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 204 */     return this.queryList.getList("getTi_voteoptionByPk", pk);
/*     */   }
/*     */ 
/*     */   public String getvote_titleById(String vote_id)
/*     */   {
/* 214 */     String vote_title = "";
/* 215 */     List namelist = this.queryList.getList("getvote_titleById", vote_id);
/* 216 */     if ((namelist != null) && (namelist.size() > 0)) {
/* 217 */       Map map = (Hashtable)namelist.get(0);
/* 218 */       if (map.get("vote_title") != null) {
/* 219 */         vote_title = map.get("vote_title").toString();
/*     */       }
/*     */     }
/* 222 */     return vote_title;
/*     */   }
/*     */ 
/*     */   public int checkVoteoption(String vote_id)
/*     */   {
/* 231 */     int g = 0;
/* 232 */     List list = this.queryList.getList("checkVoteoption", vote_id);
/* 233 */     if ((list != null) && (list.size() > 0))
/* 234 */       g = 1;
/* 235 */     return g;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_voteoption.Ti_voteoptionInfo
 * JD-Core Version:    0.6.0
 */